package proxy.java;

import com.ww.microrpc.netty.handler.client.SendCallback;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ProxyHandler implements InvocationHandler {
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        for (int i = 0; i < args.length; i++) {
            System.out.println(args.getClass());
            Object arg = args[i];
            if (arg instanceof SendCallback) {
                SendCallback sendCallback = (SendCallback) arg;
                sendCallback.onSuccess("success");
                System.out.println(sendCallback.getClass());
            }
        }

        return "name";
    }
}
